#pragma once
#include <iostream>
#include <string>
#include <vector>
#include "sqlite3.h"

class Database
{
public:	
	/* char* filename | The path to the file that contains the database */
	Database(char* filename);
	~Database();
	
	/*
	Executes a SQL query statement
	std::string query | The query to be executed
	Returns: bool | If the action has been successful or not
	*/
	bool Execute(std::string query);
	/*
	Get the name of each columns of a table
	std::string tableName | The name of the table to query
	Returns: std::vector<std::string> | A vector containing columns name as string
	*/
	std::vector<std::string> GetColumnsName(std::string tableName);
	/*
	Get the row ID if the last inserted row in the database
	Returns: int | The ID of the last inserted row
	*/
	int GetLastInsertedRowId();
	/*
	Get the first line of data according to a SQL query statement
	std::string query | The query to be executed
	Returns: std::vector<std::string> | A vector containing the data for each columns of a row
	*/
	std::vector<std::string> GetLine(std::string query);
	/*
	Get the value of the first occuring column according to a SQL query statement
	std::string query | The query to be executed
	Returns: std::string | The first occuring column according to the SQL query statement
	*/
	std::string GetOneShot(std::string query);
	/*
	Opens the access to a database file
	char* filename | The path to the file that contains the database
	Returns: bool | If the database was open or not
	*/
	bool Open(char* filename);
	/*
	Get a collection of data lines according to a SQL query statement
	std::string query | The query to be executed
	Returns: std::vector<vector<std::string>> | A two dimensions vector containing the data for each columns
	*/
	std::vector<std::vector<std::string>> Query(std::string query);
	
private:
	sqlite3* mDatabase;
};